<?php

class User_Form_CreateUser extends Pldkp_Form 
{ 
    public function init()
    { 
        $this->setName('create_user');

        $email = new Zend_Form_Element_Text('email');
        $email->setRequired(true)
              ->setLabel('Email')
              ->setDescription('This will be your username')
              ->addValidator('EmailAddress', false, array())
              ->addValidator('UniqueEntry', false, array('User_Model_Users', 'email'))
              ->addValidator('NotEmpty');
        
        $emailReference = new Zend_Form_Element_Text('email_ref');
        $emailReference->setRequired(true)
                       ->setLabel('Confirm Email')
                       ->addValidator('NotEmpty')
                       ->addValidator('ConfirmationField', false, array('email'));

        $name = new Zend_Form_Element_Text('name');
        $name->setRequired(true)
             ->setLabel('Name')
             ->setDescription('This is the name people will see')
             ->addValidator('StringLength', false, array(4))
             ->addValidator('UniqueEntry', false, array('User_Model_Users', 'name'))
             ->addValidator('NotEmpty');
        
        
        $password = new Zend_Form_Element_Password('password');
        $password->setRequired(true)
                 ->setLabel('Password')
                 ->setDescription('Minimum 6 characters')
                 ->addValidator('StringLength', false, array(6))
                 ->addValidator('NotEmpty');
                 
        $passwordReference = new Zend_Form_Element_Password('password_ref');
        $passwordReference->setRequired(true)
                          ->setLabel('Confirm password')
                          ->addValidator('NotEmpty')
                          ->addValidator('ConfirmationField', false, array('password'));
              
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Create');
        
        $this->addElements(array($email, $emailReference, $name, $password, $passwordReference, $submit));  
    }
}